home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Amiga Classic Collection
/
The Amiga Classic Collection - Disc 1.iso
/
Games
/
G587-StoneTowers.DMS
/
G587-StoneTowers.adf
/
STOWERS.amos
/
STOWERS.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1996-09-05
|
11KB
|
410 lines
Dim POLE(8,8),XOLD(2),YOLD(2)
Global POLE(),X,Y,PL,ER,XOLD(),YOLD(),P1,P2,PLACOM,KOM$,MTAH
Track Loop On
'Track Load "Music.mod",1
Proc INIT
Do
Proc UVOD
For TAH=1 To MTAH
For PL=1 To 2
If PL=2 and PLACOM
Hide On
KOM$="BLUE player turn... Amiga moves!" : Proc KOM
Proc VYBERSICOM
Else
If PL=1
KOM$="RED player turn... "+Str$(MTAH-TAH+1)+" turns to go."
Else
KOM$="BLUE player turn... "+Str$(MTAH-TAH+1)+" turns to go."
End If
Proc KOM
Proc VYBERSI
End If
Proc ZAPISMAPU
Proc SKORE
Show On
Next PL
Next TAH
Proc VYSLEDKY
Loop
Procedure INIT
Hide On : Colour 1,$0
Curs Off : Flash Off
Text 80,120,"Loading STONE TOWERS"
Screen Open 2,640,256,16,Hires : Screen Hide 2 : Curs Off : Flash Off
Load Iff "STOWERS.DAT1",2
Screen Open 3,320,256,32,Lowres : Screen Hide 3 : Curs Off : Flash Off
Track Play 1
Screen Show 2 : Screen Close 0
Load Iff "STOWERS.DAT2",3 : Screen Hide 3
T=Timer+250
Repeat
Until(T<Timer) or Mouse Key
Screen Show 3 : Screen Hide 2
Screen Close 2
Screen Open 1,640,256,16,Hires
Screen Hide 1
Curs Off : Flash Off
Limit Mouse
Limit Mouse 129,43 To 399,275
'Load "STONESOUND.ABK"
Proc CTIBLOKY
T=Timer+250
Repeat
Until(T<Timer) or Mouse Key
Screen Show 1
Screen Close 3
End Proc
Procedure VYBERSI
Flash Off
If PL=1
Flash 15,"(500,5)(a00,5)(f00,5)(a00,5)"
Else
Flash 15,"(225,5)(55a,5)(55f,5)(55a,5)"
End If
X Mouse=X Hard(XOLD(PL))
Y Mouse=Y Hard(YOLD(PL))
X=0 : Y=0
Repeat
Repeat
XI=X Screen(X Mouse) : YI=Y Screen(Y Mouse)
XOLD(PL)=XI : YOLD(PL)=YI
XI=XI/80+1 : YI=YI/35+1
If XI>7 or YI>7 or XI<1 or YI<1
XI=X : YI=Y
End If
If Not(X=XI and Y=YI)
Ink 1 : Box(X-1)*80,(Y-1)*35 To X*80,Y*35
Ink 15 : Box(XI-1)*80,(YI-1)*35 To XI*80,YI*35
X=XI : Y=YI
ER=False
If POLE(X,Y)>0 and PL=2 : ER=True : End If
If POLE(X,Y)=-4 and PL=2 : ER=True : End If
If POLE(X,Y)<0 and PL=1 : ER=True : End If
If POLE(X,Y)=4 and PL=1 : ER=True : End If
End If
Until Mouse Key
MK= Not ER
If ER
Sam Stop 3 : Sam Play 3,6 : Wait 100
End If
Until MK
Hide On
For I=1 To 3
Ink 15 : Box(X-1)*80,(Y-1)*35 To X*80,Y*35 : Wait 2
Ink 15 : Box(X-1)*80+1,(Y-1)*35+1 To X*80-1,Y*35-1 : Wait 2
Ink 15 : Box(X-1)*80+2,(Y-1)*35+2 To X*80-2,Y*35-2 : Wait 2
Ink 1 : Box(X-1)*80,(Y-1)*35 To X*80,Y*35 : Wait 2
Ink 1 : Box(X-1)*80+1,(Y-1)*35+1 To X*80-1,Y*35-1 : Wait 2
Ink 1 : Box(X-1)*80+2,(Y-1)*35+2 To X*80-2,Y*35-2 : Wait 2
Next I
Show On
End Proc
Procedure ZAPISMAPU
If PL=1
If POLE(X,Y)>0
Inc POLE(X,Y)
Else
POLE(X,Y)=2
End If
Proc DEJHRAD
If Y>1 and POLE(X,Y-1)=0 : POLE(X,Y-1)=1 : Dec Y : Proc DEJHRAD : Inc Y : End If
If Y<7 and POLE(X,Y+1)=0 : POLE(X,Y+1)=1 : Inc Y : Proc DEJHRAD : Dec Y : End If
If X>1 and POLE(X-1,Y)=0 : POLE(X-1,Y)=1 : Dec X : Proc DEJHRAD : Inc X : End If
If X<7 and POLE(X+1,Y)=0 : POLE(X+1,Y)=1 : Inc X : Proc DEJHRAD : Dec X : End If
End If
If PL=2
If POLE(X,Y)<0
Dec POLE(X,Y)
Else
POLE(X,Y)=-2
End If
Proc DEJHRAD
If Y>1 and POLE(X,Y-1)=0 : POLE(X,Y-1)=-1 : Dec Y : Proc DEJHRAD : Inc Y : End If
If Y<7 and POLE(X,Y+1)=0 : POLE(X,Y+1)=-1 : Inc Y : Proc DEJHRAD : Dec Y : End If
If X>1 and POLE(X-1,Y)=0 : POLE(X-1,Y)=-1 : Dec X : Proc DEJHRAD : Inc X : End If
If X<7 and POLE(X+1,Y)=0 : POLE(X+1,Y)=-1 : Inc X : Proc DEJHRAD : Dec X : End If
End If
Repeat
ER=False
For X=1 To 7 : For Y=1 To 7
S=POLE(X,Y)-Sgn(POLE(X,Y))
S=S+POLE(X-1,Y)-Sgn(POLE(X-1,Y))
S=S+POLE(X+1,Y)-Sgn(POLE(X+1,Y))
S=S+POLE(X,Y-1)-Sgn(POLE(X,Y-1))
S=S+POLE(X,Y+1)-Sgn(POLE(X,Y+1))
If PL=1
If S>0 and POLE(X,Y)<0
ZBORHRAD
POLE(X,Y)=1 : ER=True
DEJHRAD
End If
Else
If S<0 and POLE(X,Y)>0
ZBORHRAD
POLE(X,Y)=-1 : ER=True
DEJHRAD
End If
End If
Next Y : Next X
Until Not ER
End Proc
Procedure SKORE
P1=0 : P2=0
For X1=1 To 7 : For Y1=1 To 7
If Sgn(POLE(X1,Y1))>0
Inc P1
End If
If Sgn(POLE(X1,Y1))<0
Inc P2
End If
Next Y1 : Next X1
Put Block 27,560,0
Ink 2,9 : Text 600,106,Str$(P1)
Ink 2,10 : Text 580,122,Str$(P2)
Ink 4
If P1>3
Bar 595,240-P1*2+3 To 600,240
End If
If P2>3
Bar 630,240-P2*2+3 To 635,240
End If
If P1>0
Ink 9
Bar 570,240-P1*2 To 595,240
End If
If P2>0
Ink 10
Bar 605,240-P2*2 To 630,240
End If
End Proc
Procedure VYBERSICOM
Z2=-100 : ER=True
Flash 15,"(225,5)(55a,5)(55f,5)(55a,5)"
For X1=7 To 1 Step -1
For Y1=7 To 1 Step -1
If POLE(X1,Y1)>-4 and POLE(X1,Y1)<1
Z1=Sgn(POLE(X1,Y1)) : ER=False
If X1>1 : Add Z1,Sgn(POLE(X1-1,Y1)) : End If
If X1<7 : Add Z1,Sgn(POLE(X1+1,Y1)) : End If
If Y1>1 : Add Z1,Sgn(POLE(X1,Y1-1)) : End If
If Y1<7 : Add Z1,Sgn(POLE(X1,Y1+1)) : End If
Z3=Sgn(POLE(X1,Y1)-1)
If X1>1 : Add Z3,Sgn(POLE(X1-1,Y1)-1) : End If
If X1<7 : Add Z3,Sgn(POLE(X1+1,Y1)-1) : End If
If Y1>1 : Add Z3,Sgn(POLE(X1,Y1-1)-1) : End If
If Y1<7 : Add Z3,Sgn(POLE(X1,Y1+1)-1) : End If
Add Z1,-Z3
If Z1>Z2
X=X1 : Y=Y1 : Z2=Z1
End If
End If
Next Y1
Next X1
If POLE(X,Y)>0 or POLE(X,Y)=-4
X=0 : Y=1
Repeat
Inc X
If X>7
X=1 : Inc Y
End If
Until(POLE(X,Y)<1 and POLE(X,Y)>-4)
End If
For I=1 To 3
Ink 15 : Box(X-1)*80,(Y-1)*35 To X*80,Y*35 : Wait 2
Ink 15 : Box(X-1)*80+1,(Y-1)*35+1 To X*80-1,Y*35-1 : Wait 2
Ink 15 : Box(X-1)*80+2,(Y-1)*35+2 To X*80-2,Y*35-2 : Wait 2
Ink 1 : Box(X-1)*80,(Y-1)*35 To X*80,Y*35 : Wait 2
Ink 1 : Box(X-1)*80+1,(Y-1)*35+1 To X*80-1,Y*35-1 : Wait 2
Ink 1 : Box(X-1)*80+2,(Y-1)*35+2 To X*80-2,Y*35-2 : Wait 2
Next I
End Proc
Procedure CTIBLOKY
Load Iff "STOWERS.DAT3"
I=0
For Y1=0 To 217 Step 36
For X1=0 To 200 Step 80
Inc I
Get Block I,X1,Y1,80,35
Next X1
Next Y1
Get Block 22,240,0,80,35
Get Block 23,240,35,80,35
Get Block 24,320,0,240,35
Get Block 25,320,36,240,35
Get Block 26,240,73,320,179
Get Block 27,560,0,80,246
Cls 1
Put Block 27,560,0
End Proc
Procedure DEJHRAD
X1=80*(X-1)
Y1=35*(Y-1)
If POLE(X,Y)=0 : Cls 1,X1,Y1 To X1+80,Y1+35 : End If
If POLE(X,Y)=1 : Put Block 22,X1,Y1 : Sam Stop 3 : Sam Play 3,1 : End If
If POLE(X,Y)=2 : Put Block 3,X1,Y1 : Sam Stop 3 : Sam Play 3,2 : Wait 64 : End If
If POLE(X,Y)=3 : Put Block 2,X1,Y1 : Sam Stop 3 : Sam Play 3,3 : Wait 64 : End If
If POLE(X,Y)=4 : Put Block 1,X1,Y1 : Sam Stop 3 : Sam Play 3,4 : Wait 64 : End If
If POLE(X,Y)=-1 : Put Block 23,X1,Y1 : Sam Stop 3 : Sam Play 3,1 : End If
If POLE(X,Y)=-2 : Put Block 6,X1,Y1 : Sam Stop 3 : Sam Play 3,2 : Wait 64 : End If
If POLE(X,Y)=-3 : Put Block 5,X1,Y1 : Sam Stop 3 : Sam Play 3,3 : Wait 64 : End If
If POLE(X,Y)=-4 : Put Block 4,X1,Y1 : Sam Stop 3 : Sam Play 3,4 : Wait 64 : End If
Wait 20
End Proc
Procedure ZBORHRAD
KOM$=""
If POLE(X,Y)>1
KOM$="Red castle fell to ruins!"
End If
If POLE(X,Y)<-1
KOM$="Blue castle fell to ruins!"
End If
Proc KOM
DC=Abs(POLE(X,Y))-1
If DC>0
Dec DC
DC=2-DC
X1=80*(X-1)
Y1=35*(Y-1)
Sam Stop 3 : Sam Play 3,8 : Put Block 7+DC,X1,Y1 : Wait 56
Sam Stop 3 : Sam Play 3,7 : Put Block 10+DC,X1,Y1 : Wait 22
Sam Stop 3 : Sam Play 3,7 : Put Block 13+DC,X1,Y1 : Wait 22
Sam Stop 3 : Sam Play 3,7 : Put Block 16+DC,X1,Y1 : Wait 22
Sam Stop 3 : Sam Play 3,7 : Put Block 19+DC,X1,Y1 : Wait 45
End If
End Proc
Procedure UVOD
For X=0 To 8
For Y=0 To 8
POLE(X,Y)=0
Next Y
Next X
For PL=1 To 2
XOLD(PL)=X Hard(300)
YOLD(PL)=Y Hard(100)
Next PL
PL=1
Cls
Put Block 27,560,0
Put Block 26,120,35
Wait 25
X Mouse=130 : Y Mouse=50
Show On
KOM$="Select ONE or TWO player game!" : Proc KOM
Repeat
ER=True
Repeat
Until Mouse Key
If X Mouse>210 and X Mouse<324
If Y Mouse>200 and Y Mouse<218 : PLACOM=False : ER=False : End If
If Y Mouse>223 and Y Mouse<242 : PLACOM=True : ER=False : End If
End If
Until ER=False
Track Stop : Led On
Sam Stop 3 : Sam Play 3,5
Cls
Put Block 27,560,0
Put Block 24,160,35
Put Block 24,160,105
Put Block 24,160,175
Ink 2,12
Text 240,50,"SHORT GAME"
Text 240,120,"MEDIUM GAME"
Text 240,190,"LONG GAME"
Ink 13,12
Text 240,60,"(15 turns)"
Text 240,130,"(27 turns)"
Text 240,200,"(40 turns)"
Wait 25
KOM$="Select number of turns." : Proc KOM
MTAH=10
Repeat
Until Mouse Key
Sam Stop 3 : Sam Play 3,5
MTAH=27
If Y Screen(Y Mouse)<88 : MTAH=15 : End If
If Y Screen(Y Mouse)>158 : MTAH=40 : End If
Cls
Put Block 27,560,0
Wait 50
End Proc
Procedure KOM
If KOM$=""
Ink 1,1
KOM$=Space$(80)
Else
Ink 2,11
If Left$(KOM$,3)="RED"
Ink 2,9
End If
If Left$(KOM$,4)="BLUE"
Ink 2,10
End If
If Left$(KOM$,1)="*"
Ink 0,2
End If
KOM$=Space$(20)+KOM$+Space$(60-Len(KOM$))
End If
Text 0,254,KOM$
End Proc
Procedure VYSLEDKY
Hide On
KOM$="" : Proc KOM
Put Block 25,160,105
Ink 0,2
Text 240,120,"GAME OVER"
Sam Stop 3 : Sam Play 3,8
Wait 40
If P1<>P2
Text 200,130,"And the winner is..."
Sam Stop 3 : Sam Play 3,8
Wait 40
Put Block 25,160,150
If P1>P2
Text 240,170,"RED KNIGHT!"
Sam Stop 3 : Sam Play 3,8
Wait 40
KOM$="RED KNIGHT WINS! Press mouse to continue." : Proc KOM
Else
Text 232,170,"BLUE KNIGHT!"
Sam Stop 3 : Sam Play 3,8
Wait 40
KOM$="BLUE KNIGHT WINS! Press mouse to continue." : Proc KOM
End If
Sam Stop 3 : Sam Play 3,4 : Wait 200
Else
Text 236,130,"++ DRAW ++"
Sam Stop 3 : Sam Play 3,8 : Wait 30
Sam Stop 3 : Sam Play 3,8 : Wait 30
Sam Stop 3 : Sam Play 3,8 : Wait 30
KOM$="No one wins. Press mouse to continue." : Proc KOM
End If
Repeat
Until Mouse Key
Track Play 1
End Proc